package cn.gd.service.Impl;

import cn.gd.mapper.UserMapper;
import cn.gd.pojo.User;
import cn.gd.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserServiceImpl implements UserService{

    @Autowired
    UserMapper userMapper;


    @Override
    @Transactional
    public void versionTest() {
        User user = userMapper.selectById(1);
        user.setUsername("小艳");
        user.setGender("女");
        user.setAge(18);

        User user1 = userMapper.selectById(1);
        user1.setUsername("小霞");
        user1.setGender("女");
        user1.setAge(18);
        userMapper.updateById(user1);
        userMapper.updateById(user);
    }
}
